#!/usr/bin/env python

import pygtk
pygtk.require('2.0')
import pynotify
import sys
import gtk
import os

if __name__ == '__main__':
	if not pynotify.init("Wifi status"):
		sys.exit(1)

	# Image URI
	uri = "file:///usr/share/icons/gnome/scalable/devices/network-wireless.svg"

	if sys.argv[1] == "off":
		n = pynotify.Notification("Wifi", "Your wireless adapter has been <b><span color='red'>disabled</span></b>. This should save power and prevent interferences in planes. Press <i>Fn-F2</i> to reenable it.", uri)
	elif sys.argv[1] == "on":
		n = pynotify.Notification("Wifi", "Your wireless adapter has been <b><span color='blue'>enabled</span></b>. You might configure it to access the internet. You can disble it by pressing <i>Fn-F2</i>.", uri)
	else:
		print "USAGE: "+sys.argv[0]+" (on|off)"
		sys.exit(1)
		
	n.set_timeout(2000)
	if not n.show():
		print "Failed to send notification"
		sys.exit(1)

